package com.cimctech.socketdemo.schedule;

import android.util.Log;

import com.cimctech.socketdemo.SocketThread;
import com.cimctech.socketdemo.utils.CheckMoth;
import com.cimctech.socketdemo.utils.TimeUtils;

import java.util.TimerTask;

public class HeartbeatSchedule extends TimerTask {
    private static final String TAG = "HeartbeatSchedule";

    private SocketThread socketThread;

    public HeartbeatSchedule(SocketThread socketThread) {
        this.socketThread = socketThread;
    }

    @Override
    public void run() {

//        报文:   *ZJ0286695703345758514080516341316#
//        String str = "*ZJ01866957033457585A2485.6174N10285.8327E1450001905152344007B#";
        String str = " *ZJ02866957033457585" + TimeUtils.gprsTime();
        Log.e(TAG, "run: " + str + CheckMoth.stringCheck(str) + "#");
        if (socketThread != null) {
            socketThread.Send(str + CheckMoth.stringCheck(str) + "#"+"\n");
        } else {
            Log.e(TAG, "run: socket无连接");
        }

    }
}
